<?php


namespace App\Http\Controllers\Admin;
use App\Models\StatisticsNum;
use Dingo\Api\Http\Request;

class SearchCategoryController extends BaseController
{
    /**
     * 列表
     * @param Request $request
     * @return mixed
     */
    public function index(Request $request) {
        $type = $request->input('type', StatisticsNum::TYPE_CITY);
        $title = $request->input('title');
        $list = StatisticsNum::where('type', $type)->when($title, function ($q) use($title){
            $q->where('title', 'like', '%'. $title . '%');
        })->limit(20)->get();
        return $this->success($list);
    }

}

